package com.tingyuge.base.thread.wang.collection.blocking;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * Created by xiaodao
 * date: 2019/12/23
 */
public class PriorityBlock {

    public static void main(String[] args) throws InterruptedException {
        PriorityBlockingQueue queue = new PriorityBlockingQueue(5);
        queue.add(1);
        queue.add(1);
        queue.add(1);
        queue.add(1);
        queue.add(1);
        queue.put(2);
        queue.peek();
        queue.remove(1);
        queue.take();//如果里面为空的话,会阻塞住
        System.out.println(queue.size());
    }
}
